#import "~/graphql_shared/fragments/label.fragment.graphql"
#import "~/graphql_shared/fragments/user.fragment.graphql"
#import "~/work_items/graphql/milestone.fragment.graphql"
#import "~/work_items/graphql/award_emoji.fragment.graphql"
#import "ee_else_ce/work_items/graphql/work_item_metadata_widgets.fragment.graphql"

fragment WorkItemWidgets on WorkItemWidget {
  ... on WorkItemWidgetDescription {
    type
    description
    descriptionHtml
    lastEditedAt
    lastEditedBy {
      name
      webPath
    }
  }
  ... on WorkItemWidgetAssignees {
    type
    allowsMultipleAssignees
    canInviteMembers
    assignees {
      nodes {
        ...User
      }
    }
  }
  ... on WorkItemWidgetLabels {
    type
    labels {
      nodes {
        ...Label
      }
    }
  }
  ... on WorkItemWidgetStartAndDueDate {
    type
    dueDate
    startDate
  }
  ... on WorkItemWidgetHierarchy {
    type
    hasChildren
    parent {
      id
      iid
      title
      confidential
      webUrl
      workItemType {
        id
        name
        iconName
      }
    }
    children {
      nodes {
        id
        iid
        confidential
        workItemType {
          id
          name
          iconName
        }
        title
        state
        createdAt
        closedAt
        widgets {
          ... on WorkItemWidgetHierarchy {
            type
            hasChildren
          }
          ...WorkItemMetadataWidgets
        }
      }
    }
  }
  ... on WorkItemWidgetMilestone {
    type
    milestone {
      ...MilestoneFragment
    }
  }
  ... on WorkItemWidgetNotes {
    type
  }
  ... on WorkItemWidgetNotifications {
    type
    subscribed
  }
  ... on WorkItemWidgetCurrentUserTodos {
    type
    currentUserTodos(state: pending) {
      edges {
        node {
          id
          state
        }
      }
    }
  }
  ... on WorkItemWidgetAwardEmoji {
    type
    awardEmoji {
      nodes {
        ...AwardEmojiFragment
      }
    }
  }
}
